<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app"></div>

    <template id="my-app">
      <div>
        您的问题: <input type="text" v-model="message">
        <button @click="queryAnswer">查找答案</button>
      </div>
    </template>

    <script src="../vue/vue.js"></script>
    <script>
        const App = {
            template: '#my-app',
            data() {
                return {
                    message: 'hello',
                    answer: ''
                }
            },
            watch: {
                // question侦听的data中的属性名称
                message(newValue, oldValue) {
                    // console.log('新', newValue, '旧', oldValue);
                    this.queryAnswer();
                }
            },  
            methods: {
                queryAnswer() {
                    console.log(`你的问题${this.message}的答案是哈哈哈哈哈`);
                }
            }
        }

        Vue.createApp(App).mount('#app');
    </script>
</body>
</html>